@import '../../styles/global.less';
.k-switch {
   min-width: 44px;
   height: 24px;
   line-height: 22px;
   border-radius: 24px;
   vertical-align: middle;
   border: 1px solid #ccc;
   background-color: #ccc;
   font-size: 12px;
   position: relative;
   cursor: pointer;
   -webkit-user-select: none;
   -moz-user-select: none;
   -ms-user-select: none;
   user-select: none;
   transition: all .36s cubic-bezier(.78, .14, .15, .86);
   display: inline-block;
   box-sizing: border-box;
   overflow: hidden;
   outline: none;
   &:focus {
      // border: 1px solid @main;
      box-shadow: 0 0 5px fade(@main, 75%);
   }
   .k-icon {
      font-size: 16px;
   }
   &::before {
      content: '';
      width: 20px;
      height: 20px;
      border-radius: 20px;
      background-color: #fff;
      position: absolute;
      left: 1px;
      top: 50%;
      cursor: pointer;
      transform: translate3d(0, -50%, 0);
      transition: all .36s cubic-bezier(.78, .14, .15, .86);
   }
   .k-switch-inner {
      color: #fff;
      margin-left: 25px;
      margin-right: 8px;
      display: flex;
      line-height: 22px;
   }
   &:active:not(&:disabled) {
      &::before {
         width: 25px;
      }
   }
   .k-switch-loading {
      color: @main;
      position: absolute;
      left: 3px;
      top: 3px
   }
}

.k-switch-sm {
   min-width: 28px;
   height: 16px;
   &::before {
      width: 12px;
      height: 12px;
      border-radius: 12px;
   }
   &:active {
      &::before {
         width: 15px;
      }
   }
   &:active:not(&:disabled) {
      &::before {
         width: 15px;
      }
   }
   .k-switch-loading {
      left: 2px;
      font-size: 10px;
      top: 2px;
   }
   &.k-switch-checked {
      .k-switch-loading {
         left: calc(100% - 11.5px);
      }
   }
}

.k-switch-checked {
   background: @main;
   border-color: @main;
   &::before {
      left: 100%;
      transform: translate3d(-100%, -50%, 0);
      margin-left: -1px;
   }
   .k-switch-inner {
      margin-left: 8px;
      margin-right: 25px;
   }
   .k-switch-loading {
      left: calc(100% - 19px);
   }
}

.k-switch-disabled {
   opacity: .6;
   cursor: not-allowed;
   .k-switch-loading {
      color: @disable-color;
   }
}